[css-color-4] set chroma to 0 when converting powerless hue to missing - #14244
Open
romainmenke wants to merge 4 commits into
Conversation
romainmenke
marked this pull request as draft
July 31, 2026 15:15
svgeesus
reviewed
Jul 31, 2026
svgeesus
left a comment
Contributor
There was a problem hiding this comment.
Looks good; one suggested link
Co-authored-by: Chris Lilley <chris@w3.org>
romainmenke
commented
Jul 31, 2026
| When changing a powerless hue component to a [=missing component=], | ||
| the chroma (or other measure of colorfulness, such as saturation in ''hsl''; see [=analogous components=]) is set to zero | ||
| to avoid amplifying floating-point noise. | ||
| In the case of ''hwb'' set ''b'' to ''100 - w'' or if either ''b'' or ''w'' is missing set the other component to ''100''. |
Member
Author
There was a problem hiding this comment.
For hwb this must only be done when W + B >= 99.999 and W + B < 100 to avoid clamping.
Maybe clearer in pseudo code than in prose?
1. if `w` + `b` is greater than `99.999` and `w` + `b` is less than `100`
2. if `w` and `b` are not missing
2.1. set `b` to `100 - w`
3. else if `w` is not missing
3.1. set `w` to `100`
4. else if `b` is not missing
4.1. set `b` to `100`
Contributor
There was a problem hiding this comment.
Yes, that is much clearer
Contributor
There was a problem hiding this comment.
The if condition on 1. covers 2. to 4. if true, right?
Member
Author
There was a problem hiding this comment.
Yes
Maybe clearer:
1. if `w` + `b` is greater than `99.999` and less than `100` and `w` and `b` are not missing
...
Or:
1. if `w` + `b` is greater than `99.999` and `w` + `b` is less than `100`
1.1. if `w` and `b` are not missing
1.1.1. set `b` to `100 - w`
1.2. else if `w` is not missing
1.2.1. set `w` to `100`
1.3. else if `b` is not missing
1.3.1. set `b` to `100`
Member
Author
There was a problem hiding this comment.
I have applied the second option and also replaced 99.999 with ε.
I've also added a clarification that this step should only be applied for other color spaces between zero and ε.
romainmenke
marked this pull request as ready for review
August 14, 2026 07:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See: #14133 (comment)